Optimal. Leaf size=38 \[ \frac {x}{b}+\frac {\sqrt {a} \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{b \sqrt {a+b}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3250, 3260,
211} \begin {gather*} \frac {\sqrt {a} \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{b \sqrt {a+b}}+\frac {x}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 3250
Rule 3260
Rubi steps
\begin {align*} \int \frac {\cos ^2(x)}{a+b \cos ^2(x)} \, dx &=\frac {x}{b}-\frac {a \int \frac {1}{a+b \cos ^2(x)} \, dx}{b}\\ &=\frac {x}{b}+\frac {a \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\cot (x)\right )}{b}\\ &=\frac {x}{b}+\frac {\sqrt {a} \tan ^{-1}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{b \sqrt {a+b}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.09, size = 36, normalized size = 0.95 \begin {gather*} \frac {x-\frac {\sqrt {a} \text {ArcTan}\left (\frac {\sqrt {a} \tan (x)}{\sqrt {a+b}}\right )}{\sqrt {a+b}}}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.08, size = 34, normalized size = 0.89
method | result | size |
default | \(\frac {\arctan \left (\tan \left (x \right )\right )}{b}-\frac {a \arctan \left (\frac {a \tan \left (x \right )}{\sqrt {\left (a +b \right ) a}}\right )}{b \sqrt {\left (a +b \right ) a}}\) | \(34\) |
risch | \(\frac {x}{b}+\frac {\sqrt {-\left (a +b \right ) a}\, \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {-\left (a +b \right ) a}+2 a +b}{b}\right )}{2 \left (a +b \right ) b}-\frac {\sqrt {-\left (a +b \right ) a}\, \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {-\left (a +b \right ) a}-2 a -b}{b}\right )}{2 \left (a +b \right ) b}\) | \(100\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 31, normalized size = 0.82 \begin {gather*} -\frac {a \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{\sqrt {{\left (a + b\right )} a} b} + \frac {x}{b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 183, normalized size = 4.82 \begin {gather*} \left [\frac {\sqrt {-\frac {a}{a + b}} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 3 \, a b\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (2 \, a^{2} + 3 \, a b + b^{2}\right )} \cos \left (x\right )^{3} - {\left (a^{2} + a b\right )} \cos \left (x\right )\right )} \sqrt {-\frac {a}{a + b}} \sin \left (x\right ) + a^{2}}{b^{2} \cos \left (x\right )^{4} + 2 \, a b \cos \left (x\right )^{2} + a^{2}}\right ) + 4 \, x}{4 \, b}, \frac {\sqrt {\frac {a}{a + b}} \arctan \left (\frac {{\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a\right )} \sqrt {\frac {a}{a + b}}}{2 \, a \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \, x}{2 \, b}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 48, normalized size = 1.26 \begin {gather*} -\frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )\right )} a}{\sqrt {a^{2} + a b} b} + \frac {x}{b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.55, size = 425, normalized size = 11.18 \begin {gather*} \frac {x}{b}-\frac {\mathrm {atan}\left (\frac {\frac {\left (2\,a^3\,\mathrm {tan}\left (x\right )-\frac {\left (2\,a^2\,b^2-\frac {\mathrm {tan}\left (x\right )\,\left (16\,a^3\,b^2+8\,a^2\,b^3\right )\,\sqrt {-a\,\left (a+b\right )}}{4\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}}{2\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}\,1{}\mathrm {i}}{b^2+a\,b}+\frac {\left (2\,a^3\,\mathrm {tan}\left (x\right )+\frac {\left (2\,a^2\,b^2+\frac {\mathrm {tan}\left (x\right )\,\left (16\,a^3\,b^2+8\,a^2\,b^3\right )\,\sqrt {-a\,\left (a+b\right )}}{4\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}}{2\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}\,1{}\mathrm {i}}{b^2+a\,b}}{\frac {\left (2\,a^3\,\mathrm {tan}\left (x\right )-\frac {\left (2\,a^2\,b^2-\frac {\mathrm {tan}\left (x\right )\,\left (16\,a^3\,b^2+8\,a^2\,b^3\right )\,\sqrt {-a\,\left (a+b\right )}}{4\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}}{2\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}}{b^2+a\,b}-\frac {\left (2\,a^3\,\mathrm {tan}\left (x\right )+\frac {\left (2\,a^2\,b^2+\frac {\mathrm {tan}\left (x\right )\,\left (16\,a^3\,b^2+8\,a^2\,b^3\right )\,\sqrt {-a\,\left (a+b\right )}}{4\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}}{2\,\left (b^2+a\,b\right )}\right )\,\sqrt {-a\,\left (a+b\right )}}{b^2+a\,b}}\right )\,\sqrt {-a\,\left (a+b\right )}\,1{}\mathrm {i}}{b^2+a\,b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________